package com.java.lesson.lesson1;

public class Lesson13_ {
    public static void main(String[] args) {
        int num = 1234;

//个位数：
        int num1 = num % 10;
//十位数：
        int num2 = num / 10 % 10;
//百位数
        int num3 = num / 100 % 10;
//千位数
        int num4 = num / 1000;

        System.out.println("个位数为：" + num1);
        System.out.println("十位数为：" + num1);
        System.out.println("百位数为：" + num1);
        System.out.println("千位数为：" + num1);



        int a=123;
//int转String
        String s=Integer.toString(a);

        System.out.println("个位数为："+s.charAt(0));
        System.out.println("十位数为："+s.charAt(1));
        System.out.println("百位数为："+s.charAt(2));

    }
}
